package com.xhai.common.enums;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * @author xhai
 * @description 统一响应返回编码
 * @date 2025/5/24
 */
@Getter
@Schema(description = "统一响应返回编码")
public enum AppHttpCodeEnum {
    // 成功
    SUCCESS(200, "操作成功"),
    // 失败
    FAIL(400, "操作失败"),
    // 登录
    NEED_LOGIN(401, "需要登录后操作"),
    NO_OPERATOR_AUTH(403, "无权限操作"),
    SYSTEM_ERROR(500, "出现错误"),
    USERNAME_EXIST(501, "用户名已存在"),
    PHONENUMBER_EXIST(502, "手机号已存在"),
    EMAIL_EXIST(503, "邮箱已存在"),
    REQUIRE_USERNAME(504, "必需填写用户名"),
    LOGIN_ERROR(505, "用户名或密码错误"),
    USERNAME_NOT_NULL(506, "用户名不能为空"),
    PASSWORD_NOT_NULL(507, "密码不能为空"),
    EMAIL_NOT_NULL(508, "邮箱不能为空"),
    NICKNAME_NOT_NULL(509, "昵称不能为空"),
    NICKNAME_EXIST(510, "昵称已存在"),
    USER_NOT_EXIST(511, "用户不存在"),
    USERNAME_NOT_EQUAL(512, "用户名与数据库中不相等"),
    CONTENT_NOT_NULL(601, "评论不能为空"),
    FILE_TYPE_ERROR(701, "文件类型错误，仅支持png、jpg、jpeg"),
    FILE_NOT_NULL(702, "文件不能为空"),
    PARAM_NOT_NULL(801, "参数不能为空"),
    ARTICLE_NOT_EXIST(901, "文章不存在"),
    MENU_NOT_EXIST(1001, "菜单不存在"),
    MENU_PARENT_CANNOT_SELF(1002, "修改菜单失败，上级菜单不能选择自己"),
    MENU_EXIST_CHILDREN(1003, "存在子菜单不允许删除"),
    ROLE_NOT_EXIST(1101, "角色不存在"),
    CATEGORY_NOT_EXIST(1201, "分类不存在"),
    LINK_NOT_EXIST(1301, "友链不存在");

    final Integer code;

    final String msg;

    AppHttpCodeEnum(Integer code, String message) {
        this.code = code;
        this.msg = message;
    }
}
